<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<center>
    <br/><br/>
    <form action="authorityServlet?method=getAuthorities" method="post">
        name:<input type="text" name="username"/>
        <input type="submit" name="提交"/>
    </form>

    <c:if test="${requestScope.user != null}">
        <br/><br/>
        ${requestScope.user.username} 的权限是：
        <br/><br/>

        <form action="authorityServlet?method=updateAuthority" method="post">
            <input type="hidden" name="username" value="${requestScope.user.username}"/>

            <c:forEach items="${authorityList}" var="auth">

                <c:set var="flag" value="false"/>

                <c:forEach items="${user.authorityList}" var="ua">
                    <c:if test="${ua.url == auth.url}">
                        <c:set var="flag" value="true"/>
                    </c:if>
                </c:forEach>

                <c:if test="${flag==true}">
                    <input type="checkbox" name="authority" checked="checked" value="${auth.url}"/>${auth.displayName}
                    <br/><br/>
                </c:if>

                <c:if test="${flag==false}">
                    <input type="checkbox" name="authority" value="${auth.url}"/>${auth.displayName}
                    <br/><br/>
                </c:if>

            </c:forEach>

            <input type="submit" name="修改"/>

        </form>

    </c:if>

</center>
</body>
</html>
